#!/bin/sh

if [ -f "/usr/libexec/aksusbd" ]; then
   newmaj=1
   newmin=11
   newrel=
   
   actmaj=$(/usr/libexec/aksusbd -v | cut -f3 -d\ | cut -f1 -d.)
   actmin=$(/usr/libexec/aksusbd -v | cut -f3 -d\ | cut -f2 -d.)
   actrel=$(/usr/libexec/aksusbd -v | cut -f3 -d\ | cut -f3 -d.)
   
   needupd=0
   
   if [ "$newmaj" -gt "$actmaj" ]; then
      # echo "Major update"
      needupd=1
   else
      if [ "$newmin" -gt "$actmin" ]; then
         # echo "Minor update"
         needupd=1
      else
         if [ "$newrel" ];then
            if [ "$actrel" ]; then
               if [ "$newrel" -gt "$actrel" ]; then
                  # echo "Release update 2"
                  needupd=1
               fi
            else
               # echo "Release update 1"
               needupd=1
            fi
         fi
      fi
   fi
   
   if [ "$needupd" == 0 ]; then
      echo "Current version already installed"
      exit 64
   fi
fi

echo "Update/Install required"
exit 0
